﻿// /////////////////////////////////// 
//  
//  
//      WiseLink CCF2.0 
//     (c)Copyright 2001-2010 WiseLink Xiaojun (David) Chen 
//        Authored and Owned Xiaojun (David) Chen 
//        All Right Reserved
//  
// /////////////////////////////////// 

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Xml.Serialization;

namespace CCF20Model.ConfigurationFile
{
    [XmlRoot(Namespace = "")]
    public class WiseLinkConfiguration
    {
        private bool _hasChanged = false;
        public bool hasChanged 
        {
            get
            {
                return _hasChanged;
            }
        }

        [XmlElement]
        public string database { get; set; }
        [XmlElement]
        public string catalog { get; set; }
        [XmlElement]
        public string user { get; set; }
        [XmlElement]
        public string password { get; set; }
        [XmlElement]
        public string zicurl { get; set; }
        [XmlElement]
        public bool isjava { get; set; }

        private bool? _isenglish = null;
        [XmlElement]
        public bool? isenglish 
        {
            get
            {
                if (_isenglish == null)
                {
                    return false;
                }
                else
                {
                    return _isenglish;
                }
            }
            set
            {
                if (value != _isenglish)
                {
                    if (_isenglish != null)
                    {
                        _hasChanged = true;//avoid the first time init
                    }
                    _isenglish = value;
                }
            }
        }
        [XmlElement]
        public string logdir { get; set; }
        [XmlElement]
        public string backupdir { get; set; }

        private string _customerType;
        [XmlElement]
        public string customertype 
        {
            get 
            {
                return _customerType; 
            }
            set
            {
                if (value != _customerType)
                {
                    if (_customerType != null)
                    {
                        _hasChanged = true;//avoid the first time init
                    }
                    _customerType = value.Replace("System.Windows.Controls.ComboBoxItem:", null).Trim();
                }
            }
        
        }
        
        public override string ToString()
        {
            return string.Format("database={0},catalog ={1},user={2},password={3},zicurl={4},logdir={5},backupdir={6},customertype={7}",
                                    database, catalog, user, password, zicurl, logdir,backupdir,customertype);

        }
    }
    public class AppConfigFileNodeName
    {
        public static string CCF20Entities = "CCF20Entities";
        public static string AspnetMembershipConnectionString = "AspnetMembershipConnectionString";
        public static string CCF20Log = "CCF20Log";
        public static string ZICDebug = "ZICDebug";
        public static string ZICMonitor = "ZICMonitor";
    }

    public enum AppConfigFileName
    {
        CCF,
        ZICMonitor
    }

    public class AppConfigFileNode
    {
        public string SectionName;
        public string NodeName;
        public string AttributeName;
    }

    

    
}
